package dc;

public class DCBBonus {

	public static Integer AW_LEVEL_NONE = 0;
	public static Integer AW_LEVEL_1 = 1;
	public static Integer AW_LEVEL_2 = 2;
	public static Integer AW_LEVEL_3 = 3;
	public static Integer AW_LEVEL_4 = 4;
	public static Integer AW_LEVEL_5 = 5;
	public static Integer AW_LEVEL_6 = 6;

	public static Integer matchAward(DCB curBall, DCB awardBall) {
		if (curBall != null && awardBall != null) {
			boolean bm = curBall.getBlue().matchAll(awardBall.getBlue());
			int rm = curBall.getRed().matchCount(awardBall.getRed());
			if (bm) {
				if (rm < 3) {
					return AW_LEVEL_6;
				} else if (rm == 3) {
					return AW_LEVEL_5;
				} else if (rm == 4) {
					return AW_LEVEL_4;
				} else if (rm == 5) {
					return AW_LEVEL_3;
				} else if (rm == 6) {
					return AW_LEVEL_1;
				}
			} else {
				if (rm == 4) {
					return AW_LEVEL_5;
				} else if (rm == 5) {
					return AW_LEVEL_4;
				} else if (rm == 6) {
					return AW_LEVEL_2;
				}
			}
		}
		return AW_LEVEL_NONE;
	}

	public static void main(String[] args) {
	}
}
